package com.uduemc.biso.module.basic.service.service.impl;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.uduemc.biso.core.extities.center.SysRole;
import com.uduemc.biso.module.basic.service.mapper.SysRoleMapper;
import com.uduemc.biso.module.basic.service.service.SysRoleService;

@Service
public class SysRoleServiceImpl implements SysRoleService {

	@Autowired
	private SysRoleMapper sysRoleMapper;

	@Override
	public SysRole insert(SysRole sysRole) {
		sysRoleMapper.insert(sysRole);
		return findOne(sysRole.getId());
	}

	@Override
	public SysRole updateById(SysRole sysRole) {
		sysRoleMapper.updateByPrimaryKey(sysRole);
		return findOne(sysRole.getId());
	}

	@Override
	public SysRole insertSelective(SysRole sysRole) {
		sysRoleMapper.insertSelective(sysRole);
		return findOne(sysRole.getId());
	}

	@Override
	public SysRole updateByIdSelective(SysRole sysRole) {
		sysRoleMapper.updateByPrimaryKeySelective(sysRole);
		return findOne(sysRole.getId());
	}

	@Override
	public SysRole findOne(long id) {
		return sysRoleMapper.selectByPrimaryKey(id);
	}

	@Override
	public List<SysRole> findAll() {
		return sysRoleMapper.selectAll();
	}

	@Override
	public int deleteById(long id) {
		return sysRoleMapper.deleteByPrimaryKey(id);
	}

}
